//npm init
// ## npm install express --save
// [ %@#$% ]

//import

var app = require('express')

var limitlink = require('express-rate-limit')

var routes = require('./routes/app_index')

//use

// ## -- defined

const Apps = app()

const port = 5001

// ## -- middle plugins

Apps.use(limitlink({
    windowMs: 60000,
    max: 110000,
    message: { error: '系统拥挤，请稍后' }
}))

Apps.use(app.json())

// ## -- routes group

routes(Apps)//make route with Apps.use

// ## -- listen server

Apps.listen(port, () => {
    console.log('ok:localhost:' + port)
})


